﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SchemaMonitor.json
{
    public class CCursors : CDict
    {
        //Data
        public readonly string After;
        public readonly string Before;

        //Constructors
        public CCursors(Dictionary<string, object> dict) : base(dict)
        {
            After  = AsStr("after");
            Before = AsStr("before");
        }

        //Derived
        public bool HasAfter { get { return !string.IsNullOrEmpty(After); } }
        public bool HasBefore { get { return !string.IsNullOrEmpty(Before); } }
        public string Summary
        {
            get
            {
                var sb = new StringBuilder();
                if (HasBefore)
                    sb.Append(" before");
                if (HasAfter)
                    sb.Append("/after");

                return sb.ToString();
            }
        }
    }
}
